﻿<%@ Page Title="" Language="C#" MasterPageFile="~/User/User.Master" AutoEventWireup="true" CodeBehind="SelectCP.aspx.cs" Inherits="CoolERP_Web.User.SelectCP" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script src="../Scripts/lhgdialog/lhgcore.min.js" type="text/javascript"></script>
<script src="../Scripts/lhgdialog/lhgdialog.js" type="text/javascript"></script>
<script type="text/javascript">
    var DG = frameElement.lhgDG;
    function doSubmit() {
        var flag = false;
        $("#GridView1 input[type=checkbox][id=chkSel]").each(function () {
            if ($(this).attr("checked") == true) {
                flag = true;
                return;
            }
        });
        if (!flag){
            alert("请至少选择一种产品");
            return false;
        }
        else {
            var goodsList = new Array();
            $("#GridView1 input[type=checkbox][id=chkSel]").each(function () {
                if ($(this).attr("checked") == true) {
                    var goods = {
                        id: $(this).val(),
                        name: $(this).closest("tr").find("td").eq(1).text(),
                        gg: $(this).closest("tr").find("td").eq(2).text(),
                        ys: $(this).closest("tr").find("td").eq(3).text(),
                        price: $(this).closest("tr").find("td").eq(4).text()
                    };
                    goodsList[goodsList.length] = goods;
                }
            });
            DG.curWin.selMore(goodsList);
        }
    }
    function selThis(obj) {
        var goods = {
            id: $(obj).val(),
            name: $(obj).closest("tr").find("td").eq(1).text(),
            gg: $(obj).closest("tr").find("td").eq(2).text(),
            yslx: $(obj).closest("tr").find("input[type=hidden]").eq(0).val(),
            ys: $(obj).closest("tr").find("input[type=hidden]").eq(1).val(),
            ysmc: $(obj).closest("tr").find("input[type=hidden]").eq(2).val(),
            price: $(obj).closest("tr").find("td").eq(4).text()
        };
        DG.curWin.selOne(goods);
    }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:HiddenField ID="hidSelIds" runat=server />
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td class=tbHead_L></td>
        <td class=tbHead_M></td>
        <td class=tbHead_R></td>
    </tr>
    <tr>
        <td class=tbBody_L></td>
        <td class=tbBody_M>
            <ul class=tags>
                <li class=liTitle><div>查找产品</div></li>
            </ul>
            <table class="grvCSS" cellspacing="0" border="1" style="width:100%;border-collapse:collapse;">
                <tr>
                    <td>产品类型：<asp:DropDownList ID="ddlType" runat="server" CssClass="dropdown"/></td>
                    <td>产品核心词：<asp:DropDownList ID="ddlHXC" runat="server" CssClass="dropdown"/></td>
                    <td>产品名称：<asp:TextBox ID="txtName" runat="server" CssClass="textbox" MaxLength="16"></asp:TextBox></td>
                    <td><asp:ImageButton ID="btnQuery" runat="server" ImageUrl="~/Images/Common/btn_query0.png" OnClick="btnQuery_Click" />
                    &nbsp;&nbsp;<asp:ImageButton ID="btnReset" runat="server" ImageUrl="~/Images/Common/btn_reset0.png" OnClick="btnReset_Click" />
                    &nbsp;&nbsp;<input type=image src="../Images/Common/btn_close.png" onclick="DG.cancel();" /></td>
                </tr>
            </table>
            <ul class=tags>
                <li class=liTitle><div>产品列表</div></li>
                <li class=liRight><img src="../Images/Common/btn_ok0.png" onclick="doSubmit()" style="cursor:pointer" />
                <font color=red>可同时选择多个，然后点击“确定”按钮</font></li>
            </ul>
            <asp:GridView ID="GridView1" runat="server" Width=100% PageSize=15 ClientIDMode=Static CssClass="grvCSS" AutoGenerateColumns="False" AllowPaging="True">
                <Columns>
                    <asp:TemplateField>
                        <HeaderTemplate><label><input type="checkbox" onclick="checkAll('GridView1',this)" />全选</label></HeaderTemplate>
                        <ItemTemplate><input type=checkbox id="chkSel" name="chkSel" value='<%# Eval("ID") %>' /></ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="产品名称" DataField="CPMC"/>
                    <asp:BoundField HeaderText="产品规格" DataField="CPGG"/>
                    <asp:TemplateField HeaderText="颜色">
                    <ItemTemplate><%# Eval("ZYSLXMC")%> <%# Eval("ZYSMC")%></ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="单价">
                    <ItemTemplate><%# Eval("DJ") == null? "0.00" : Convert.ToDecimal(Eval("DJ")).ToString("F")%></ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="产品类型" DataField="CPLXMC"/>
                    <asp:BoundField HeaderText="产品核心词" DataField="CPMCMC"/>                                
                </Columns>
                <PagerSettings Visible=false />
            </asp:GridView>
            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" AlwaysShow="True" CssClass="pager" UrlPaging="false" ShowCustomInfoSection="Left"
                FirstPageText="首页" LastPageText="尾页" PrevPageText="前页" NextPageText="后页" OnPageChanged="AspNetPager1_PageChanged" 
                TextAfterPageIndexBox="页" TextBeforePageIndexBox="转到" PageIndexBoxType="TextBox" ShowPageIndexBox="Always" 
                SubmitButtonText="Go" CustomInfoHTML="共%RecordCount%条数据，每页%PageSize%条，共%PageCount%页，当前为第%CurrentPageIndex%页">
            </webdiyer:AspNetPager>
            <asp:Panel ID="panMsg" runat="server" ClientIDMode=Static CssClass="msg24_attention" Visible=false>无相关数据</asp:Panel>
        </td>
        <td class=tbBody_R></td>
    </tr>
    <tr>
        <td class=tbFoot_L></td>
        <td class=tbFoot_M></td>
        <td class=tbFoot_R></td>
    </tr>
</table>
</asp:Content>
